<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.cqggrw.domain.*"%>
<%@ page import="com.cqggrw.service.*"%>
<%@ page import="com.cqggrw.service.impl.*"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>重庆公共人物网后台管理</title>
<link type="text/css" rel="Stylesheet" href="../Content/tabbed_pages.css" />
<link type="text/css" rel="Stylesheet" href="../Content/Index.css" />
<script type="text/javascript" src="../../jslib/jquery-1.8.0.min.js"></script>
<%
	String idStr = request.getParameter("id");
	Link link = null;
	if(idStr != null) {
		LinkServiceI service = new LinkServiceImpl();
		link = new Link();
		link.setId(Integer.parseInt(idStr));
		link = (Link)service.get(link);
	}
%>
<script type="text/javascript">
function WebForm_OnSubmit() {
	var falg = true;
	if(document.getElementById("txtname").value.length == 0) {
		$('#txtnameSpan').html('<font color="red">*必填</font>');
		return false;
	}else if(document.getElementById("txturl").value == 'http://') {
		$('#txturlSpan').html('<font color="red">*必填</font>');
		return false;
	}
	return falg;
}

</script>
</head>
<body>
	<form name="form1" method="post" action="linkAction!modify.action" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
		<input type="hidden" name="id" value="<%=link.getId() %>" />
		<div class="form-div textLeft">
			<h1>
				<span class="action-span"><a href="LinkList.jsp">链接列表</a> </span> <span class="action-span1 fs20">公共人物网 管理中心 </span><span class="action-span1 paddingTop5"> - 添加链接 </span>
			</h1>
			<div style="clear:both"></div>
		</div>
		<div id="gallery">
			<div class="on" title="CommonInfo">
				<span>添加友情链接</span>
			</div><%
			String message = (String)request.getAttribute("message"); 
			if(message != null) {
				out.print(message);
			}
			%>
		</div>
		<div id="CommonInfo" class="show">
			<table width="90%" id="general-table" align="center">
				<tr>
					<td>链接名称：<input name="name" type="text" value="<%=link.getName() %>" id="txtname" /> <span id="txtnameSpan" ></span></td>
				</tr>
				<tr>
					<td>链接地址：<input name="url" type="text" value="<%=link.getUrl() %>" id="txturl" /> <span id="txturlSpan"></span></td>
				</tr>
			</table>
		</div>
		<div class="form-div textLeft" style="text-align:center;margin-top:5px;">
			<input type="submit" name="btnSave" value="保存" onclick="" id="btnSave" class="button" />
		</div>
	</form>
</body>
</html>